<template>
  <div class="bottom_box">
    <div class="left-nav">
      <el-menu :default-active="activeIndex" class="el-menu-nav" mode="vertical" @select="handleSelect">
        <el-menu-item index="1">全国薪资分位数设置</el-menu-item>
        <el-menu-item index="2">工作经验薪资设置</el-menu-item>
        <el-menu-item index="3">不同学历薪资设置</el-menu-item>
        <el-menu-item index="4">城市排名设置</el-menu-item>
        <!-- <el-menu-item index="5">招聘热度设置</el-menu-item> -->
      </el-menu>
    </div>
    <div class="right-content">
      <PercentSalarySetting v-if="activeIndex == 1" :nationwideBaseSalary="baseSalary.nationwideBaseSalary">
      </PercentSalarySetting>
      <WorkSalarySetting v-if="activeIndex == 2" :nationwideExpSalary="baseSalary.nationwideExpSalary">
      </WorkSalarySetting>
      <EduSalarySetting v-if="activeIndex == 3" :nationwideEduSalary="baseSalary.nationwideEduSalary">
      </EduSalarySetting>
      <CityRankSetting v-if="activeIndex == 4"></CityRankSetting>
      <PositionHeatSetting v-if="activeIndex == 5" :heatTrend="baseSalary.heatTrend"></PositionHeatSetting>
    </div>
  </div>
</template>
<script>
import PercentSalarySetting from "./components/percentSalarySetting";
import WorkSalarySetting from "./components/workSalarySetting";
import EduSalarySetting from "./components/eduSalarySetting";
import CityRankSetting from "./components/cityRankSetting";
import PositionHeatSetting from "./components/positionHeatSetting";
import { getBaseSalary } from "@/api/salary";

export default {
  name: "publicationManage",
  components: {
    PercentSalarySetting,
    WorkSalarySetting,
    EduSalarySetting,
    CityRankSetting,
    PositionHeatSetting,
  },
  data() {
    return {
      positionId: "",
      loading: false,
      activeIndex: "1",
      baseSalary: {},
    };
  },
  created() {
    this.positionId = this.$route.query.id;
    this.getData();
  },
  methods: {
    getData() {
      this.loading = true;
      let params = {
        ylPositionId: this.positionId,
      };
      //console.log("params---getBaseSalary--------->--------->", params);
      getBaseSalary(params)
        .then((res) => {
          this.loading = false;
          if (+res.code === 200) {
            this.baseSalary = res.data;
            //console.log("getBaseSalary--------->", this.baseSalary);
          }
        })
        .catch((err) => {
          this.loading = false;
        });
    },
    handleSelect(key, keyPath) {
      //console.log("handleSelect--------->", key, keyPath);
      this.activeIndex = key;
      this.getData();
    },
  },
};
</script>

<style lang="scss" scoped>
.bottom_box {
  display: flex;
  //   padding: 14px 14px 14px 4px;
  background: #fff;

  .left-nav {
    // width: 180px;
    margin-top: 20px;
    // height: 100vh;
    background-color: #fff;
  }
  .left-nav::before {
    content: "";
    position: absolute;
    left: 190px;
    top: 0;
    height: 100%;
    width: 1px; /* 或者设置边框属性如border-left: 1px solid black; */
    background-color: #e4e7ed; /* 或者设置边框颜色如border-color: black; */
  }

  .right-content {
    width: 500;
    height: 100%;
    background-color: #fff;
    // border-left: 1px solid rgb(28, 1, 1);
  }
  ::v-deep .el-menu-item {
    padding-left: 15px !important;
  }
  ::v-deep .el-menu {
    background: #fff;
    border-right: solid 1px #fff;
  }
}
</style>
